In [1]:
from classy import Class
/home/kolen/.conda/envs/all3-intel/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: numpy.ufunc size changed, may indicate binary incompatibility. Expected 216, got 192
  return f(*args, **kwds)
In [2]:
import os
import io
In [3]:
import pandas as pd
import numpy as np
In [4]:
import matplotlib.pyplot as plt
In [21]:
import plotly.offline as py
py.init_notebook_mode()
In [22]:
from dautil.plot import iplot_column_slider
In [5]:
%matplotlib inline
In [6]:
LambdaCDM = Class()
In [18]:
from dautil.plot import iplot_column_slider
In [7]:
# optional: clear content of LambdaCDM (to reuse it for another model)
LambdaCDM.struct_cleanup()
# optional: reset parameters to default
LambdaCDM.empty()
In [8]:
kwargs = {
    # background parameters
    'H0': 67.32117,
    'omega_b': 0.02238280,
    'N_ur': 2.03066666667,
    'omega_cdm': 0.1201075,
    'N_ncdm': 1,
    'omega_ncdm': 0.0006451439,

    'YHe': 0.2454006,
    'tau_reio': 0.05430842,

    'n_s': 0.9660499,
    'A_s': 2.100549e-09,

    'non linear': 'halofit',

    'output': 'tCl,pCl,lCl,mPk',
    'lensing': 'yes',
#     'P_k_max_1/Mpc': 3.,
#     'l_max_scalars': 3000,
}
LambdaCDM.set(kwargs)
Out[8]:
True
In [9]:
LambdaCDM.compute()
In [10]:
df = pd.DataFrame(LambdaCDM.lensed_cl())
df.set_index('ell', inplace=True)
ell = df.index.values.astype(np.int32)
df *= ((ell * (ell + 1)) * 0.5 / np.pi)[:, None]
df.columns = ['TT', 'EE', 'TE', 'BB', 'phiphi', 'TPhi']
# df *= 1.e12
In [11]:
df.head()
Out[11]:
TT EE TE BB phiphi TPhi
ell
0 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
1 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
2 1.367932e-10 4.159485e-15 3.526335e-13 2.408172e-19 8.134962e-09 4.445106e-10
3 1.295945e-10 5.349734e-15 3.964504e-13 4.817285e-19 5.054137e-09 3.156333e-10
4 1.227547e-10 4.643087e-15 3.707844e-13 8.030879e-19 3.519417e-09 2.389402e-10
In [12]:
temp = LambdaCDM.get_thermodynamics()
In [14]:
df_thermo = pd.DataFrame(temp)
In [16]:
df_thermo.set_index('z', inplace=True)
In [25]:
df_thermo.tail()
Out[25]:
conf. time [Mpc] x_e kappa' [Mpc^-1] exp(-kappa) g [Mpc^-1] Tb [K] c_b^2 tau_d
z
9997.5 42.969997 1.16377 45.272178 0.0 0.0 27250.91175 5.651667e-09 11877.451044
9998.0 42.967995 1.16377 45.276706 0.0 0.0 27252.27450 5.651950e-09 11878.786264
9998.5 42.965993 1.16377 45.281234 0.0 0.0 27253.63725 5.652233e-09 11880.121558
9999.0 42.963991 1.16377 45.285763 0.0 0.0 27255.00000 5.652515e-09 11881.456929
9999.5 42.961989 1.16377 45.290291 0.0 0.0 27256.36275 5.652798e-09 11882.792374
In [23]:
py.iplot(iplot_column_slider(df_thermo))